package org.summer.lawyer.constant.enums;

import cn.hutool.core.util.ArrayUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 *
 */
@Getter
@AllArgsConstructor
public enum PayOrderStatus {

    /**
     * 待支付
     */
    PENDING(0, "待支付"),

    /**
     * 支付成功
     */
    SUCCESS(1, "支付成功"),

    /**
     * 已退款
     */
    REFUND(2, "已退款"),

    /**
     * 支付关闭
     */
    CLOSED(3, "支付关闭");

    public static PayOrderStatus getByCode(Integer code) {
        return ArrayUtil.firstMatch(item -> Objects.equals(item.getCode(), code), values());
    }

    private final  Integer code;

    private final String info;
}
